package m3u8tourl.src.com;

import util.src.com.WriteText;

import java.io.IOException;

import java.util.LinkedList;
import java.util.Queue;

/**
 * @Author: Gosin
 * @Date: 2020/10/29 10:11
 */
public class GetAllTsUrls extends WriteText {

    public static Queue<String> queue = new LinkedList<String>();
    public String urlHeader;

    public GetAllTsUrls(String m3u8Path, String m3u8Name, String textPath, String textName, String urlHeader) {
        super(m3u8Path, m3u8Name, textPath, textName);
        this.urlHeader = urlHeader;

    }

    @Override
    protected String selectUrl(String line) {
        if (line != null) {
            //使用readLine方法，一次读一行
            if (line.endsWith(".ts")) {
                //添加元素
                queue.offer(urlHeader + line);
                return (urlHeader + line);
            }
            return null;
        }
        return null;
    }

}
